﻿namespace Tuxedo.Compile
{
	internal class ThrowStatement : CodeLine
	{
		private Expression expression;

		public ThrowStatement(Expression expression)
		{
			this.expression = expression;
		}

		public static CodeLine Parse(TokenStream tokens)
		{
			tokens.PopExpected("throw");
			Expression expression = Expression.ParseExpression(tokens);
			tokens.PopExpected(";");

			return new ThrowStatement(expression);
		}
	}
}
